//---------------------------------------------------------------------------
/**
 * \class CLock
 * \brief This is a class for locking a file exclusively 
 * \version 0.1
 *
 * \author Woo-Hyun Kim (woorung@nhncorp.com, woorung@gmail.com)
 * \author http://blog.naver.com/wisereign .
 *
 * \date 2008/10/13
 */
//---------------------------------------------------------------------------
#ifndef CLockH
#define CLockH

#include <iostream>
#include <iterator>
#include <vector>
#include <list>
#include <algorithm>
#include <fstream>
#include <string>
#include <map>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <errno.h>
//---------------------------------------------------------------------------
#define DEFAULT_LOCK_FILE "/tmp/.wooh.lck"
//---------------------------------------------------------------------------
using namespace std;
//---------------------------------------------------------------------------
class CLock {
private :
	FILE *lock_fp;
	int lock_fd;

	int status;
	int is_lock;

protected :

public :
	CLock();
	CLock(const char *lckf);
	virtual ~CLock();

	int lock();
	int unlock();
};
//---------------------------------------------------------------------------
#endif
